#pragma once

#include "Widget/QRSWidgetBase.h"
#include "ui_StretchOperationWidget.h"

#include "Render/QIVtkSelectionPipeline.h"

QT_BEGIN_NAMESPACE
namespace Ui { class StretchOperationWidgetClass; };
QT_END_NAMESPACE

class MainWindow;
class ShapeOperation;

class StretchOperationWidget : public QRSWidgetBase
{
	Q_OBJECT

public:
	StretchOperationWidget(MainWindow* inMainWindow, ShapeOperation* inOperation = nullptr, QWidget* parent = nullptr);
	~StretchOperationWidget();

protected:
	void OnSelectedSubShapes(QIVtkSelectionPipeline* actor);
	virtual void closeEvent(QCloseEvent* event) override;
	bool eventFilter(QObject* obj, QEvent* event) override;

	void OnModify();
	void OnConfirm();

	void OnTargetComboIndexChange(int index);

private:
	Ui::StretchOperationWidgetClass *ui;
protected:
	bool bUseEdge = false;
	gp_Vec stretchVector;
	int focusIndex = 0;

	Handle(QIVtkSelectionPipeline) cacheActor;
	Handle(QIVtkSelectionPipeline) m_selectedActor;
	std::vector<vtkSmartPointer<vtkActor>> selectTempActor;

	std::vector<std::reference_wrapper<const TopoDS_Shape>> m_shapelist;
	RWTripleFloatInput* m_dir;
};
